@Configuration
public class CodisConfiguration {
@Value(“${codis.zookeeper.clients}”)
private String zkClients;
@Value(“${codis.zookeeper.proxyDir}”)
private String zkDir;
@Value(“${codis.poolConfig.maxIdle}”)
private int maxIdle;
@Value(“${codis.poolConfig.maxTotal}”)
private int maxTotal;
@Bean
public JedisResourcePool jedisResourcePool() {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxIdle(maxIdle);
poolConfig.setMaxTotal(maxTotal);
poolConfig.setTestOnBorrow(true);
return RoundRobinJedisPool.create().curatorClient(zkClients, 30000).zkProxyDir(zkDir)
.poolConfig(poolConfig).build();
}
}